//
//  DownloadManager.h
//  ebook
//
//  Created by ChenNan on 16/4/26.
//  Copyright © 2016年 Moton. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "ReaderConfig.h"
#import "Chapter.h"
#import "Book.h"
#import "DownloadModel.h"

@interface DownloadManager : NSObject

+ (instancetype)shareInstance;


/*服务器下载数据文件夹*/
@property (nonatomic,copy) NSString *chapterContentDirectory;//章节内容
@property (nonatomic,copy) NSString *zipDirectory;//整包压缩包
@property (nonatomic,copy) NSString *bookfileDirectory;//章节列表


//恢复之前的下载
-(void)restoreDownload;
-(void)reloadData;
//当前下载对象
-(DownloadModel *)currentDownload;

//添加一个下载,是否立即开始
-(BOOL)addDownload:(DownloadModel *)download;

//当前显示的是错误页内容
-(BOOL)isErrorContent:(NSString *)content;

//判断一本书是否在在下载队列中,返回下载队列对象
-(DownloadModel *)downloadQuequOfBook:(NSString *)bookid;

//直接下载
-(void)downloadBook:(Book *)book currentChapter:(Chapter *)chapter chapterList:(NSArray *)chapterlist downloadType:(DownloadType)downloadType needNoti:(BOOL)need;

-(NSString *)cdnUrl:(NSString *)url;

//章节内容文件地址
-(NSString *)chapterContentUrl :(Book *)book :(Chapter *)chapter;
//网络章节内容获取
-(NSString *)getNetChaptercontent:(Book *)book chapter:(Chapter *)chapter;

//Dictionary类型的列表转为Chapter对象类型的列表
- (NSMutableArray *)dictListToChapterList:(NSArray *)array;

@end
